package com.wjv.example.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.wjv.example.common.entity.ResultInfo;
import com.wjv.example.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

/**
 * <p>Title: PaymentController</p>
 * <p>Company:misspao </p>
 *
 * @author: wjv
 * @Date: Create in 16:58 2020/9/24
 * @Description:
 */
@RestController
@RequestMapping("/payment")
public class PaymentController {
    @Autowired
    private PaymentService paymentService;

    @Value("${server.port}")
    private String port;

    @GetMapping("/get")
    public ResultInfo get(@RequestParam("id") int id) {
        return ResultInfo.okMsg(paymentService.info1(id));
    }

    @GetMapping("/get2")
    public ResultInfo get2(@RequestParam("id") int id) {
        return ResultInfo.okMsg(paymentService.info2(id));
    }

    @GetMapping("/get3")
    public String paymentCircuitBreaker(@RequestParam("id") Integer id) {
        return paymentService.paymentCircuitBreaker(id);
    }

    @GetMapping("/get5")
    public ResultInfo get5() {
        return ResultInfo.okMsg("port: " + port);
    }
}
